package com.hist.medical_treatment.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hist.medical_treatment.entity.User;
import com.hist.medical_treatment.service.UserService;

@Controller
public class UserController {
         @Autowired
         UserService service;   
         
         @ResponseBody
         @RequestMapping("/getUser")
         public List<User> getUser(){
        	 return service.getUser();
         }
         @ResponseBody
         @RequestMapping("/deleteByID")
         public void deleteUserByID(Integer id){
        	 service.deleteUserByID(id);
         }
         @ResponseBody
         @RequestMapping("/updateUserById")
         public void updateUserByID(Integer id, String userName, String realName, Integer useType, Integer docTitleId,
     			String isScheduling, Integer deptId, Integer registLeId) {
        	 // TODO Auto-generated method stub
     		service.updateUserByID(id, userName, realName, useType, docTitleId, isScheduling, deptId, registLeId);
         }
         @ResponseBody
         @RequestMapping("/getIDByConstantName")
     	public Integer getIDByConstantName(String constantName) {
     		// TODO Auto-generated method stub
     		return service.getIDByConstantName(constantName);
     	}

         @ResponseBody
         @RequestMapping("/getIDByDeptName")
     	public Integer getIDByDeptName(String deptName) {
     		// TODO Auto-generated method stub
     		return service.getIDByDeptName(deptName);
     	}

         @ResponseBody
         @RequestMapping("/getIDByRegistName")
     	public Integer getIDByRegistName(String registName) {
     		// TODO Auto-generated method stub
     		return service.getIDByRegistName(registName);
     	}
         @ResponseBody
         @RequestMapping("/insertUser")
         public void insertUser(String userName,String password, String realName, Integer useType, Integer docTitleId, String isScheduling,
     			Integer deptId, Integer registLeId) {
     		// TODO Auto-generated method stub
     		service.insertUser(userName,password, realName, useType, docTitleId, isScheduling, deptId, registLeId);
     	}
         @ResponseBody
         @RequestMapping("/getPassword")
     	public String getPassword(Integer id) {
     		// TODO Auto-generated method stub
     		return service.getPassword(id);
     	}

         @ResponseBody
         @RequestMapping("/updatePassword")
     	public void updatePassword(Integer id,String password) {
     		// TODO Auto-generated method stub
     		service.updatePassword(id,password);
     	}
}
